import { ToggleButton } from "../components/ToggleButton"
import { RichEditorProps } from "../toolbar"
import { RichUtils } from "draft-js"
import onClickify from "../libs/onClickify"
export const CodeBlockName = "CODE"

const CODE = ({ editorState, onChange }: RichEditorProps) => {
    return (
        <ToggleButton
            onMouseDown={onClickify(() => {
                onChange(
                    RichUtils.toggleBlockType(editorState, "code-block")
                )
            })}
        >
            code
        </ToggleButton>
    )
}
export default CODE